import request from '@/utils/request'

// 查询【项目划款】列表
export function listDealPayment(query) {
  return request({
    url: '/payment/dealPayment/list',
    method: 'get',
    params: query
  })
}

// 查询【项目划款】列表合计
export function getDealPaymentSum(query) {
  return request({
    url: '/payment/dealPayment/getSum',
    method: 'get',
    params: query
  })
}

export function listDealPaymentByResult(query) {
  return request({
    url: '/payment/dealPayment/listByResult',
    method: 'get',
    params: query
  })
}

export function getDealPaymentSumByResult(query) {
  return request({
    url: '/payment/dealPayment/getSumByResult',
    method: 'get',
    params: query
  })
}

// 查询【项目划款】详细
export function getDealPayment(id) {
  return request({
    url: '/payment/dealPayment/' + id,
    method: 'get'
  })
}

// 保存【项目划款】
export function saveDealPayment(data) {
  return request({
    url: '/payment/dealPayment/save',
    method: 'post',
    data: data
  })
}

// 删除【项目划款】
export function delDealPayment(id) {
  return request({
    url: '/payment/dealPayment/' + id,
    method: 'delete'
  })
}

// 导出【项目划款】
export function exportDealPayment(query) {
  return request({
    url: '/payment/dealPayment/export',
    method: 'get',
    params: query
  })
}

// 删除付款主体
export function deleteDealPaymentDetail(id) {
  return request({
    url: '/payment/dealPayment/detail/' + id,
    method: 'delete'
  })
}

// 收款方历史记录 (使用的Oa的对外付款的方法)
// export function getPayeeHistory() {
//   return request({
//     url: '/payment/oaPayment/getPayeeHistory',
//     method: 'get'
//   })
// }

// 维护付款时间
export function updatePayTime(data) {
  return request({
    url: '/payment/dealPayment/updatePayTime',
    method: 'post',
    data: data
  })
}

// 分析报表-管理驾驶舱-最新划款
export function findLatestPayment(query) {
  return request({
    url: '/payment/dealPayment/findLatestPayment',
    method: 'get',
    params: query
  })
}

export function getTheRemainingAmount(dealId, contractId, id) {
  return request({
    url: '/payment/dealPayment/getTheRemainingAmount/' + dealId + '/' + contractId + '/' + id,
    method: 'get'
  })
}

/**
 * 获取暂存数据
 * @param paymentId
 * @returns {AxiosPromise}
 */
export function obtainTemporaryStorage(paymentId) {
  return request({
    url: '/payment/dealPayment/obtainTemporaryStorage/' + paymentId,
    method: 'get'
  })
}

/**
 * 维护付款时间暂存按钮
 * @param investmentList
 * @returns {AxiosPromise}
 */
export function temporaryStorageInvest(investmentList) {
  return request({
    url: '/payment/dealPayment/temporaryStorageInvest',
    method: 'post',
    data: investmentList
  })
}

export function deletePaymentMaintain(investment) {
  return request({
    url: '/payment/dealPayment/deletePaymentMaintain',
    method: 'get',
    params: investment
  })
}

export function deletePaymentMaintainByIdList(idList) {
  return request({
    url: '/payment/dealPayment/deletePaymentMaintainByIdList',
    method: 'get',
    params: idList
  })
}

export function getPaymentTimeFile(paymentIds) {
  return request({
    url: '/payment/dealPayment/getPaymentTimeFile/' + paymentIds,
    method: 'get'
  })
}

export function fallback(id) {
  return request({
    url: '/payment/dealPayment/fallback/' + id,
    method: 'get'
  })
}

export function autoMaintenancePaymentStatus(id, status) {
  return request({
    url: '/payment/dealPayment/autoMaintenancePaymentStatus/' + id + '/' + status,
    method: 'get'
  })
}
